<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../static/教师端.css">
    <link rel="stylesheet" href="../static/iconfont/iconfont.css">
    <title>个人信息</title>
</head>
<body>
<div class="head">
    <div class="header">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<img width=36 height=36 src="../static/xh.png"/><img width=180 height=36 src="../static/wz.png"/>
        <a href="/teacher/login" class="exit"><i class="iconfont icon-tuichu"></i>退出登录</a></div>
</div>
<div class="big_box">
    <div class="wrap">
        <div class="seg"></div>
        <div class="item_title">
            <b>教师端</b>
        </div>
        <div class = "seg"></div>
        <div class="item">
            <a href="http://localhost:8080/teacher/tutorial"><i class="iconfont icon-yixuan" ></i>&ensp;任教课程</a>
        </div>
        <div class="item">
            <a href="http://localhost:8080/teacher/up_course"><i class="iconfont icon-fabu" ></i>&ensp;发布课程</a>
        </div>
        <div class="item">
            <a href="http://localhost:8080/teacher/modify_course"><i class="iconfont icon-xiugai" ></i>&ensp;修改课程</a>
        </div>
        <div class="item">
            <a href="http://localhost:8080/teacher/delete_course"><i class="iconfont icon-shanchu" ></i>&ensp;删除课程</a>
        </div>
        <div class="item">
            <a href="教师个人信息"><i class="iconfont icon-gerenxinxi" ></i>&ensp;个人信息</a>
        </div>
    </div>
    <div class="ps_info">
        <div class="row">
            <h1>个人信息&ensp;<i class="iconfont icon-gerenxinxi" style="font-size: 25px;"></i></h1>
        </div>
        <div class="info">
<!--            <a class="edit" onclick="edit()">编辑<i class="iconfont icon-xiugai" style="font-size: 17px;"></i></a><br /><br />-->
            <form action="\ps_info_tc" method="post">
                <td>工号：<input placeholder="工号" disabled="disabled" th:value="${Teacher.Id}"/><br /></td>
                <td>姓名：<input placeholder="姓名" disabled="disabled" th:value="${Teacher.name}"/><br /></td>
                <td>性别：<input placeholder="性别" disabled="disabled" th:value="${Teacher.sex}"/><br /></td>
                <td>院系：<input placeholder="院系" disabled="disabled" th:value="${Teacher.faculty}"/><br /></td>
                <td>密码：<input placeholder="密码" disabled="disabled" th:value="${Teacher.password}"/>&nbsp;<input class="button" type="button" value="修改密码" onclick="modifypw()"/></td><!--</tr>-->
            </form>
        </div>
        <div class="modal" id="myModal" style="display: none;">
            <div class="modal-dialog">
                <form class="modal-content" action="/modify" method="post" id="Form" role="form">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" onclick="Default()">
                            <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
                        </button>
                    </div>
                    <h4 class="modal-title">请修改密码</h4>
                    <div class="modal-body" style="padding-left: 40px;">
                        <form id="course_form">
                            <tr>
                                <td>原&emsp;密&emsp;码：<input placeholder="原密码" type="text" id="teacher_password" disabled="disabled" th:value="${Teacher.password}" /><br /></td>
                                <td>新&emsp;密&emsp;码：<input placeholder="新密码" type="text" id="teacher_npw"/><br /></td>
                                <td>确认新密码：<input placeholder="新密码" type="text" id="teacher_qrnpw"/></td><br /><br />
                            </tr>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn_default" data-dismiss="modal" onclick="Default()">取消</button>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
                        <button type="button" class="btn_primary" onclick="newpsw()">确定</button>
                    </div>
                </form>
            </div>
        </div>
</div>
<script language="JavaScript" type="text/javascript">
    function  edit() {
        document.getElementById("myModal2").style.display="block";
    }
    function  Default() {
        document.getElementById("myModal").style.display="none";
        document.getElementById("myModal2").style.display="none";
    }
    function modifypw(){
        document.getElementById("myModal").style.display="block";}
    function save(){
        alert(document.getElementById("newpw").value);
    }
    function logout() {
        $.ajax({
            async:false,
            type:"post",
            url:'/student/login',
            contentType:"application/x-www-form-urlencoded;charset=utf-8",
            dataType:"text",
            complete:function(){
                window.location.reload();
            }
        })

    }
    function newpsw() {
        var psw = document.getElementById("teacher_npw").value;
        var psw1 = document.getElementById("teacher_qrnpw").value;
        $.ajax({
            url:"/teacher/修改密码",
            type: "GET",
            data:{
                psw: psw,
                psw1: psw1,
            },
            success: function (msg) {
                if(msg=="psw"){
                    alert("新密码不能为空！！！");
                }else if(msg=="psw1"){
                    alert("请确认密码！！！");
                }else if(msg=="unequal"){
                    alert("两次密码不匹配！！！");
                }else if(msg=="yes"){
                    alert("密码修改成功！！！");
                    window.open("/teacher/教师个人信息","_self");
                }
            },
            error: function (error) {
                alert("请检查网络连接！！！");
            }
        })
    }
</script>
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<script>window.jp || document.write('<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.24/assets/js/vendor/jquery.min.js"><\/script>')</script>
</div>
</body>
</html>